var prefix = ctx +"module/shop"
var intervalId = null
var formSelects = null
var currPage = 0; // 用于保存当前页码的全局变量
$(function() {
    load();
});
function load(){
    layui.use(['form','table','laydate'], function() {
        var form = layui.form ,
            table = layui.table, laydate = layui.laydate,formSelects = layui.formSelects;//载入table模块
        form.on('select(feedId)', function (data) {
            var deviceShowType = $("#deviceShowType").val();
            if(deviceShowType == 0){
                getTemperatureRecordData1(0, $("#shopId").val(), 4);
                if (intervalId != null){
                    clearInterval(intervalId);
                }
                intervalId = setInterval(function(){
                    reLoadCurrPage()
                    getTemperatureRecordData1(0, $("#shopId").val(), 4);
                },120000);
                // getTemperatureRecordData1(0, $("#shopId").val(), 4);
            }else{
                getTemperatureNodeRecordData1(0,  $("#shopId").val(), deviceShowType);
                if (intervalId != null){
                    clearInterval(intervalId);
                }
                intervalId = setInterval(function(){
                    reLoadCurrPage()
                    getTemperatureNodeRecordData1(0,  $("#shopId").val(), deviceShowType);
                },120000);
                // getTemperatureNodeRecordData1(0,  $("#shopId").val(), deviceShowType);
            }
        });
        laydate.render({
            elem: '#export_date1',
            isInitValue: false,
            type: "datetime",
            format: 'yyyy-MM-dd HH:mm:ss',
        })
        laydate.render({
            elem: '#export_date2',
            isInitValue: false,
            type: "datetime",
            format: 'yyyy-MM-dd HH:mm:ss',
        })
        laydate.render({
            elem: '#search_date',
            isInitValue: false,
            done:function (value, data) {
                var deviceShowType = $("#deviceShowType").val();
                if(deviceShowType == 0){
                    getTemperatureRecordData1(0, $("#shopId").val(), 4);
                    if (intervalId != null){
                        clearInterval(intervalId);
                    }
                    intervalId = setInterval(function(){
                        reLoadCurrPage()
                        getTemperatureRecordData1(0, $("#shopId").val(), 4);
                    },120000);
                    // getTemperatureRecordData1(0, $("#shopId").val(), 4);
                }else{
                    getTemperatureNodeRecordData1(0,  $("#shopId").val(), deviceShowType);
                    if (intervalId != null){
                        clearInterval(intervalId);
                    }
                    intervalId = setInterval(function(){
                        reLoadCurrPage()
                        getTemperatureNodeRecordData1(0,  $("#shopId").val(), deviceShowType);
                    },120000);
                    // getTemperatureNodeRecordData1(0,  $("#shopId").val(), deviceShowType);
                }
            }
        });
        var screenHeight = window.innerHeight;
        console.log('screenHeight',screenHeight)

        var searchParams = {};
        searchParams['search_like_shopName']=$('#shopName').val();
        searchParams['search_eq_shopType']=$('#shopType').val();
        searchParams['search_eq_pianquId']=$('#pianquId').val();
        searchParams['search_eq_positionType']=$("#positionType").val();
        searchParams['shopIds']=formSelects.value('select3', 'valStr');
        searchParams['search_eq_isFire']=0;
        searchParams['shop_type']=4;
        //初始化table
        table.render({
            elem: '#exampleTable',//承载数据的table Id
            url: ctx + "/module/device/node" + "/nodeData/nodeDataList",//请求数据连接
            toolbar: '#toolbarDemo',
            cellMinWidth: 80,//全局定义所有常规单元格的最小宽度（默认：60）
            height: screenHeight - 150,
            even: true,//是否开启隔行变色
            loading:true,//是否显示加载条
            where :{
                searchParams:searchParams,
                sorts:{"state":"desc"}
            },
            defaultToolbar: false,
            //page: true,//是否分页
            page: { //支持传入 laypage 组件的所有参数（某些参数除外，如：jump/elem） - 详见文档
                layout: [ 'prev', 'page', 'next', 'skip', 'count','limit'] //自定义分页布局
            },
            cols: [[
                // {type:'numbers',title: '序号', width:'5%'},
                // { field : 'id',  title : '企业ID',align : 'center', width: 80},
                { field : 'shopName',  title : '企业名称',align : 'center', },
                { field : 'valueInfo',  title : '数据信息',align : 'center', },

            ]],
            id: 'currentTableId',//表格Id
            done: function(res, curr, count){
                if (curr != currPage || currPage == 0){
                    currPage = curr;
                    if (res && res.data && res.data.length > 0){
                        var data = res.data[0];
                        $("#shopId").val(data.shopId)
                        $("#showShopName").html('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + data.shopName)
                        $("#deviceShowType").val(data.deviceShowType)
                        if(data.deviceShowType == 0){
                            document.getElementById("daySearch1").style.display="";
                            document.getElementById("daySearch2").style.display="";
                            document.getElementById("nodeDaySearch1").style.display="none";
                            document.getElementById("nodeDaySearch2").style.display="none";
                            getTemperatureRecordData1(0, data.shopId, 4);
                            if (intervalId != null){
                                clearInterval(intervalId);
                            }
                            intervalId = setInterval(function(){
                                reLoadCurrPage()
                                getTemperatureRecordData1(0, data.shopId, 4);
                            },120000);

                        }else{
                            document.getElementById("daySearch1").style.display="none";
                            document.getElementById("daySearch2").style.display="none";
                            document.getElementById("nodeDaySearch1").style.display="";
                            document.getElementById("nodeDaySearch2").style.display="";
                            getTemperatureNodeRecordData1(0, data.shopId, data.deviceShowType);
                            if (intervalId != null){
                                clearInterval(intervalId);
                            }
                            intervalId = setInterval(function(){
                                reLoadCurrPage()
                                getTemperatureNodeRecordData1(0, data.shopId, data.deviceShowType);
                            },120000);
                        }
                    }
                }

                currPage = curr;
            } //解决最右侧列不能固定的问题
        });
        /**
         * 操作栏tool  监听事件
         */
        table.on('tool(currentTableFilter)', function (obj) {
            if (obj.event === 'edit') {  // 监听添加操作
                console.log('obj',obj.data.id);
                edit(obj.data.id);
            } else if (obj.event === 'delete') {  // 监听删除操作
                console.log('obj',obj.data.id);
                remove(obj.data.id);
            } else if(obj.event === 'device'){
                if(obj.data.deviceShowType == 0){
                    goDevice(obj.data.id);
                }else{
                    goNodes(obj.data.id)
                }
            }
        });
        // 监听搜索操作
        form.on('submit(data-search-btn)', function (data) {
            //执行搜索重载
            reLoad();
            return false;
        });
        // form.on('submit(data-export-btn)', function (data) {
        //     var pianquId = $("#pianquId").val();
        //     var shopName = $("#shopName").val();
        //     var export_date = $("#export_date").val();
        //     var feedId = $("#feedId").val();
        //     if (!export_date){
        //         layer.msg("请先选择导出时间");
        //         return false;
        //     }else {
        //         window.location.href = ctx + 'module/device/node/nodeData/export?pianquId='
        //             + pianquId + '&shopName='+shopName+'&export_date=' + export_date
        //             + '&feedId=' + feedId + '&isFire=' + '0' + '&shopType=' + '4' + '&isUnqualified=' + '1';
        //     }
        //
        // });
        /**
         * 工具栏  监听事件
         */
        table.on('toolbar(currentTableFilter)', function (obj) {
            if (obj.event === 'add') {  // 监听添加操作
                add();
            } else if (obj.event === 'upload') {  // 批量上传设备
                batchAdd();
            } else if (obj.event === 'upload_user') {  // 批量上传设备
                batchAddUser();
            }
        });

        table.on('row(currentTableFilter)', function (obj) {
            $("#shopId").val(obj.data.shopId)
            $("#showShopName").html('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + obj.data.shopName)
            $("#deviceShowType").val(obj.data.deviceShowType)
            if(obj.data.deviceShowType == 0){
                document.getElementById("daySearch1").style.display="";
                document.getElementById("daySearch2").style.display="";
                document.getElementById("nodeDaySearch1").style.display="none";
                document.getElementById("nodeDaySearch2").style.display="none";
                document.getElementById("divTemp0").style.display="none";
                document.getElementById("divTemp1").style.display="none";
                document.getElementById("divTemp2").style.display="none";
                document.getElementById("divTemp3").style.display="none";
                document.getElementById("divTemp4").style.display="none";
                document.getElementById("divTemp5").style.display="none";
                document.getElementById("divTemp6").style.display="none";
                document.getElementById("divTemp7").style.display="none";
                getTemperatureRecordData1(0, obj.data.shopId, 4);
                if (intervalId != null){
                    clearInterval(intervalId);
                }
                intervalId = setInterval(function(){
                    reLoadCurrPage()
                    getTemperatureRecordData1(0, obj.data.shopId, 4);
                },120000);
                // getTemperatureRecordData1(0, obj.data.shopId, 4);
            }else{
                document.getElementById("daySearch1").style.display="none";
                document.getElementById("daySearch2").style.display="none";
                document.getElementById("nodeDaySearch1").style.display="";
                document.getElementById("nodeDaySearch2").style.display="";
                document.getElementById("divTemp0").style.display="none";
                document.getElementById("divTemp1").style.display="none";
                document.getElementById("divTemp2").style.display="none";
                document.getElementById("divTemp3").style.display="none";
                document.getElementById("divTemp4").style.display="none";
                document.getElementById("divTemp5").style.display="none";
                document.getElementById("divTemp6").style.display="none";
                document.getElementById("divTemp7").style.display="none";
                getTemperatureNodeRecordData1(0, obj.data.shopId, obj.data.deviceShowType);
                if (intervalId != null){
                    clearInterval(intervalId);
                }
                intervalId = setInterval(function(){
                    reLoadCurrPage()
                    getTemperatureNodeRecordData1(0, obj.data.shopId, obj.data.deviceShowType);
                },120000);
            }
        });
        function reLoad() {
            currPage = 0;
            var searchParams = {};
            searchParams['search_like_shopName']=$('#shopName').val();
            searchParams['search_eq_shopType']=$('#shopType').val();
            searchParams['search_eq_pianquId']=$('#pianquId').val();
            searchParams['search_eq_positionType']=$("#positionType").val(),
            searchParams['shopIds']= formSelects.value('select3', 'valStr');
            searchParams['search_eq_isFire']=0;
            searchParams['shop_type']=4;
            layui.use(['table'], function() {
                var table = layui.table;//载入table模块
                var  page = $(".layui-laypage-skip").find("input").val() //当前页码值
                console.log('page',page)
                table.reload('currentTableId', {
                    page: {curr: page}
                    , where: {
                        searchParams: searchParams,
                        sorts:{"state":"desc"}
                    }
                }, 'data');
            });
        }
        function reLoadCurrPage() {
            var searchParams = {};
            searchParams['search_like_shopName']=$('#shopName').val();
            searchParams['search_eq_shopType']=$('#shopType').val();
            searchParams['search_eq_pianquId']=$('#pianquId').val();
            searchParams['search_eq_positionType']=$("#positionType").val(),
                searchParams['shopIds']= formSelects.value('select3', 'valStr');
            searchParams['search_eq_isFire']=0;
            searchParams['shop_type']=4;
            layui.use(['table'], function() {
                var table = layui.table;//载入table模块
                table.reload('currentTableId', {
                    page: {curr: currPage}
                    , where: {
                        searchParams: searchParams,
                        sorts:{"state":"desc"}
                    }
                }, 'data');
            });
        }
    });
}
function exportTemData() {
        var pianquId = $("#pianquId").val();
        var shopName = $("#shopName").val();
        var export_date1 = $("#export_date1").val();
        var export_date2 = $("#export_date2").val();
        var feedId = $("#feedId").val();
        if (!export_date1){
            layer.msg("请先选择开始导出时间");
            return false;
        }else {
            layer.msg("导出中，请稍后...");
            window.location.href = ctx + 'module/device/node/nodeData/export?pianquId='
                + pianquId + '&shopName='+shopName+'&export_date1=' + export_date1+'&export_date2=' + export_date2
                + '&feedId=' + feedId + '&isFire=' + '0' + '&shopType=' + '4' + '&isUnqualified=' + '1';
        }
}


/**
 * 获取设备的统计
 */
function getTemperatureRecordData1(type, shopId, shopType) {
    var url = ctx + "module/device/shop/device/charts/data";
    $.ajax({
        cache : true,
        type : "POST",
        url : url,
        data:{
            positionType: $("#positionType").val(),
            shopId: $("#shopId").val(),
            feedId: $("#feedId").val(),
            searchDate: $("#search_date").val(),
            shopType: shopType,
            dateType: type,
        },
        async : false,
        error : function(request) {
            layer.alert("Connection error");
        },
        success : function(data) {
            console.log('data',data);
            let all_data_2 = data.all_data_2;
            let all_data_3 = data.all_data_3;

            if(all_data_2.dataList != undefined && all_data_2.dataList.length > 0){
                // reloadTempData1(all_data_2);
                reloadTempData2(all_data_2);
            }

            console.log('all_data_3',all_data_3)
            console.log('all_data_3.length',all_data_3.length)
            if(all_data_3.dataList != undefined && all_data_3.dataList.length > 0){
                reloadDianLiuData1(all_data_3);
            }
        }
    });
}

function reloadTempData1(data){

    var times = data.dataList[0].times;

    var legend = data.deviceNames;

    var series = [];
    for (let index in data.dataList){
        var values = data.dataList[index].values;

        for(let i in  values){
            let value = values[i];
            if(value == "" || value == "null"){
                values[i] = null;
            }
        }
        console.log("values", values);
        let serie = {
            type:'line',
            name: legend[index],
            data: values,
            smooth: true // 可选，使线条平滑
            // itemStyle: {
            //     normal: {
            //         label: {
            //             show: true, //开启显示
            //             position: 'top', //在上方显示
            //             textStyle: { //数值样式
            //                 color: 'blue',
            //                 fontSize: 16
            //             }
            //         }
            //     }
            // },
        };
        series.push(serie);
    }


    var lineChart = echarts.init(document.getElementById("echarts-line-chart-wendu"));
    lineChart.clear();
    var lineoption = {
        tooltip : {
            trigger: 'axis',
            show : true
        },
        legend: {
            data: legend
        },
        grid:{
            x:30,y:30,x2:5
        },
        calculable : false,
        xAxis : {
            type: 'category',
            data: times,
        },
        yAxis : [
            {
                type : 'value',
                // max:100,
                axisLabel : {
                    formatter: '{value}'
                }
            }
        ],
        series : series,
    };
    lineChart.setOption(lineoption);
    $(window).resize(lineChart.resize);
}

function reloadTempData2(data){
    document.getElementById("divTemp0").style.display="none";
    document.getElementById("divTemp1").style.display="none";
    document.getElementById("divTemp2").style.display="none";
    document.getElementById("divTemp3").style.display="none";
    document.getElementById("divTemp4").style.display="none";
    document.getElementById("divTemp5").style.display="none";
    document.getElementById("divTemp6").style.display="none";
    document.getElementById("divTemp7").style.display="none";
    for (let index in data.dataList){
        document.getElementById("divTemp"+index).style.display="";
        var times = data.dataList[index].times;

        var legendstr =  data.deviceNames[index]
        var legends =  []
        legends.push(data.deviceNames[index])
        var values = data.dataList[index].values;
        for(let i in  values){
            let value = values[i];
            if(value == "" || value == "null"){
                values[i] = null;
            }
        }
        var series = [];
        let serie = {
            type:'line',
            name: legendstr,
            data: values,
            // showSymbol: false,
            // symbolSize: 7,
            label: {
                normal: {
                    show: false // 不显示所有标记点
                }
            },
            smooth: true // 可选，使线条平滑
            // itemStyle: {
            //     normal: {
            //         label: {
            //             show: true, //开启显示
            //             position: 'top', //在上方显示
            //             textStyle: { //数值样式
            //                 color: 'blue',
            //                 fontSize: 16
            //             }
            //         }
            //     }
            // },
        };
        series.push(serie);

        var lineChart = echarts.init(document.getElementById("echarts-line-chart-wendu"+index));
        var lineoption = {
            tooltip : {
                trigger: 'axis',
                show : true
            },
            legend: {
                data: legends
            },
            grid:{
                x:30,y:30,x2:5
            },
            calculable : true,
            xAxis : {
                type: 'category',
                data: times,
                boundaryGap: false,
            },
            yAxis : [
                {
                    type : 'value',
                    max:100,
                    axisLabel : {
                        formatter: '{value}'
                    }
                }
            ],
            series : series,
        };
        lineChart.setOption(lineoption);
        $(window).resize(lineChart.resize);
    }
}

function reloadDianLiuData1(data){

    var times = data.dataList[0].times;

    var legend = data.deviceNames;

    var series = [];
    for (let index in data.dataList){
        var values = data.dataList[index].values;

        for(let i in  values){
            let value = values[i];
            if(value == "" || value == "null"){
                values[i] = null;
            }
        }
        console.log("values", values);
        let serie = {
            type:'line',
            name: legend[index],
            data: values,
            smooth: true // 可选，使线条平滑
            // itemStyle: {
            //     normal: {
            //         label: {
            //             show: true, //开启显示
            //             position: 'top', //在上方显示
            //             textStyle: { //数值样式
            //                 color: 'blue',
            //                 fontSize: 16
            //             }
            //         }
            //     }
            // },
        };
        series.push(serie);
    }


    var lineChart = echarts.init(document.getElementById("echarts-line-chart-dianliu"));
    lineChart.clear();
    var lineoption = {
        tooltip : {
            trigger: 'axis',
            show : true
        },
        legend: {
            data: legend
        },
        grid:{
            x:30,y:30,x2:5
        },
        // calculable : true,
        xAxis : {
            type: 'category',
            data: times,
        },
        yAxis : [
            {
                type : 'value',
                axisLabel : {
                    formatter: '{value}'
                }
            }
        ],
        series : series,
    };
    lineChart.setOption(lineoption);
    $(window).resize(lineChart.resize);
}

/**
 * 获取节点的统计
 */
function getTemperatureNodeRecordData1(type, shopId, deviceShowType) {
    var url = ctx + "module/device/node/charts/dataNew";
    $.ajax({
        cache : true,
        type : "POST",
        url : url,
        data:{
            positionType: $("#positionType").val(),
            searchDate: $("#search_date").val(),
            feedId: $('#feedId').val(),
            shopId:  $('#shopId').val(),
            deviceShowType: $('#deviceShowType').val(),
            dateType: type,
        },
        async : false,
        error : function(request) {
            layer.alert("Connection error");
        },
        success : function(data) {
            console.log('data',data);
            let all_data_2 = data.all_data_2;
            let all_data_3 = data.all_data_3;

            if(all_data_2.dataList != undefined && all_data_2.dataList.length > 0){
                reloadNodeTempData2(all_data_2);
                // reloadNodeTempData1(all_data_2);
            }
            // else{
            //     $("#divTemp").css("display", "none");
            // }

            console.log('all_data_3',all_data_3)
            console.log('all_data_3.length',all_data_3.length)
            if(all_data_3.dataList != undefined && all_data_3.dataList.length > 0){
                reloadNodeDianLiuData1(all_data_3);
            }else{
                $("#divDianliu").css("display", "none");
            }
        }
    });
}


function reloadNodeTempData1(data){

    var times = data.dataList[0].times;

    var legend = data.deviceNames;

    var series = [];
    for (let index in data.dataList){
        var values = data.dataList[index].values;
        for(let i in  values){
            let value = values[i];
            if(value == "" || value == "null"){
                values[i] = null;
            }
        }
        let serie = {
            type:'line',
            name: legend[index],
            data: values,
            smooth: true // 可选，使线条平滑
            // itemStyle: {
            //     normal: {
            //         label: {
            //             show: true, //开启显示
            //             position: 'top', //在上方显示
            //             textStyle: { //数值样式
            //                 color: 'blue',
            //                 fontSize: 16
            //             }
            //         }
            //     }
            // },
        };
        series.push(serie);
    }


    var lineChart = echarts.init(document.getElementById("echarts-line-chart-wendu"));
    lineChart.clear();
    var lineoption = {
        tooltip : {
            trigger: 'axis',
            show : true
        },
        legend: {
            data: legend
        },
        grid:{
            x:30,y:30,x2:5
        },
        calculable : true,
        xAxis : {
            type: 'category',
            data: times,
            boundaryGap: false,
        },
        yAxis : [
            {
                type : 'value',
                // max:100,
                axisLabel : {
                    formatter: '{value}'
                }
            }
        ],
        series : series,
    };
    lineChart.setOption(lineoption);
    $(window).resize(lineChart.resize);
}

function reloadNodeTempData2(data){

    for (let index in data.dataList){
        document.getElementById("divTemp"+index).style.display="";
        var times = data.dataList[index].times;

        var legendstr =  data.deviceNames[index]
        var legends =  []
        legends.push(data.deviceNames[index])
        var values = data.dataList[index].values;
        for(let i in  values){
            let value = values[i];
            if(value == "" || value == "null"){
                values[i] = null;
            }
        }
        var series = [];
        let serie = {
            type:'line',
            name: legendstr,
            data: values,
            smooth: true // 可选，使线条平滑
            // itemStyle: {
            //     normal: {
            //         label: {
            //             show: true, //开启显示
            //             position: 'top', //在上方显示
            //             textStyle: { //数值样式
            //                 color: 'blue',
            //                 fontSize: 16
            //             }
            //         }
            //     }
            // },
        };
        series.push(serie);

        var lineChart = echarts.init(document.getElementById("echarts-line-chart-wendu"+index));
        var lineoption = {
            tooltip : {
                trigger: 'axis',
                show : true,
                formatter: function (params) {
                    // params 是一个包含当前数据信息的数组
                    var result = params[0].name + '<br/>';
                    result += params[0].axisValue + '<br/>';
                    params.forEach(function (item) {
                        result += item.seriesName + ': ' + item.value + '<br/>';
                    });
                    return result;
                }
            },
            legend: {
                data: legends
            },
            grid:{
                x:30,y:30,x2:5
            },
            calculable : true,
            xAxis : {
                type: 'category',
                data: times,
                boundaryGap: false,
            },
            yAxis : [
                {
                    type : 'value',
                    max:100,
                    axisLabel : {
                        formatter: '{value}'
                    }
                }
            ],
            series : series,
        };
        lineChart.setOption(lineoption);
        $(window).resize(lineChart.resize);
    }
}


function reloadNodeDianLiuData1(data){

    var times = data.dataList[0].times;

    var legend = data.deviceNames;

    var series = [];
    for (let index in data.dataList){
        var values = data.dataList[index].values;

        for(let i in  values){
            let value = values[i];
            if(value == "" || value == "null"){
                values[i] = null;
            }
        }
        let serie = {
            type:'line',
            name: legend[index],
            data: values,
            smooth: true // 可选，使线条平滑
            // itemStyle: {
            //     normal: {
            //         label: {
            //             show: true, //开启显示
            //             position: 'top', //在上方显示
            //             textStyle: { //数值样式
            //                 color: 'blue',
            //                 fontSize: 16
            //             }
            //         }
            //     }
            // },
        };
        series.push(serie);
    }


    var lineChart = echarts.init(document.getElementById("echarts-line-chart-dianliu"));
    lineChart.clear();
    var lineoption = {
        tooltip : {
            trigger: 'axis',
            show : true
        },
        legend: {
            data: legend
        },
        grid:{
            x:30,y:30,x2:5
        },
        calculable : true,
        xAxis : {
            type: 'category',
            data: times,
        },
        yAxis : [
            {
                type : 'value',
                axisLabel : {
                    formatter: '{value}'
                }
            }
        ],
        series : series,
    };
    lineChart.setOption(lineoption);
    $(window).resize(lineChart.resize);
}


/**
 * 获取设备的统计
 */
function getDianLiuRecordData1(type) {
    var url = ctx + "module/device/shop/device/charts/data";
    $.ajax({
        cache : true,
        type : "POST",
        url : url,
        data:{
            positionType: $("#positionType").val(),
            searchDate: $("#search_date").val(),
            shopId: $("#shopId").val(),
            shopType: 4,
            dateType: type,
        },
        async : false,
        error : function(request) {
            layer.alert("Connection error");
        },
        success : function(data) {
            console.log('data',data);
            var times = data.times;
            var values = data.values;
            // var values1 = data.values1;

            $("#begin_date").val(data.beginDate);
            $("#end_date").val(data.endDate);

            var lineChart = echarts.init(document.getElementById("echarts-line-chart-dianliu"));
            lineChart.clear();
            var lineoption = {
                tooltip : {
                    trigger: 'axis',
                    show : true
                },
                grid:{
                    x:30,y:30,x2:5
                },
                // calculable : true,
                xAxis : {
                    type: 'category',
                    data: times,
                },
                yAxis : [
                    {
                        type : 'value',
                        axisLabel : {
                            formatter: '{value}'
                        }
                    }
                ],
                series :
                    {
                        type:'line',
                        name: '温度',
                        data:values,
                        itemStyle: {
                            normal: {
                                label: {
                                    show: true, //开启显示
                                    position: 'top', //在上方显示
                                    textStyle: { //数值样式
                                        color: 'blue',
                                        fontSize: 16
                                    }
                                }
                            }
                        },
                    },
            };
            lineChart.setOption(lineoption);
            $(window).resize(lineChart.resize);
        }
    });
}
